
function foodService($http){
    var ms = this;


    function getFoodsByMerchantId(merchantId, callback){
        $http.get("/o2o/client/foods/merchantId/"+merchantId).then(function(res){
            console.log('foodService  getFoodsByMerchantId success '+ res.data);
            callback(null, res.data);
        }).catch(function(error){
            console.log("foodService  getFoodsByMerchantId error ")
        });
    }

    function getFoodsByType(type, merchantId, callback){
        $http.get("/o2o/client/foods/type/"+type+"/merchantId/"+merchantId).then(function(res){
            console.log('foodService  getFoodsByType success '+res.data);
            callback(null, res.data);
        }).catch(function(error){
            console.log("foodService  getFoodsByType error ")
        });
    }

    return {
        getFoodsByMerchantId : getFoodsByMerchantId,
        getFoodsByType: getFoodsByType
    }
}

module.exports = foodService;